import {defineConfig} from 'vite'
import vue from '@vitejs/plugin-vue'
import styleImport, {VantResolve} from 'vite-plugin-style-import';


// https://vitejs.dev/config/
export default defineConfig({
        plugins: [
            vue(),
            // 按需引入vant组件
            // styleImport({
            //   resolves: [VantResolve()],
            // }),
        ],
        server: {
            proxy: {
                // 使用 proxy 实例
                '/api/users': {
                    target: 'http://39.108.126.114:10010/',
                    // target: 'http://localhost:8180/',
                    changeOrigin: true,
                    rewrite: (path) => path.replace(/^\/api/, ''),
                    configure:(proxy, options) => {
                        console.log("@@/api==>configure==>proxy",proxy)
                        console.log("@@/api==>configure==>options",options)
                    }
                },
                '/api/entrusts': {
                    // target: 'http://39.108.126.114:10010/',
                    target: 'http://localhost:8180/',
                    changeOrigin: true,
                    rewrite: (path) => path.replace(/^\/api/, ''),
                    configure:(proxy, options) => {
                        console.log("@@/api==>configure==>proxy",proxy)
                        console.log("@@/api==>configure==>options",options)
                    }
                },
            }
        }
    }
)